<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="../common/header.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>DSP</title>
<%@include file="../common/link.jsp"%>
<style>
.chk-company {
	padding: 3px;
	margin: 3px;
}

.mouse_hour {
	background-color: #F9E4E4;
	cursor: pointer;
}
.selecteds{
	border:  1px solid #06F;
	background-color:#D2E0F2;
}
</style>
<script src="javascript?type=Com"></script>
<script>
	var config = {
		url : 'calcs'
	}
</script>
</head>

<body>
	<form action="" id="form1" onsubmit="return false;">
		<input type="hidden" name="id" id="id" value="" />
		<table width="100%" cellspacing="3" cellpadding="3"
			bordercolor="#DEDEDC" border="0" id="id-form">
			<tr>
				<th width="10%" class="td_left" valign="middle">计算年月:</th>
				<td width="19%"><select name="calcYearMonth" id="calcYearMonth">
						<%
							java.sql.Date dd = new java.sql.Date(System.currentTimeMillis());
							int year = dd.getYear() + 1900;
							int month = dd.getMonth() + 1;
							for (int i = 3; i >= 1; i--) {
								int _month = month - i;
								if (_month < 0) {
									out.println("<option value='" + (year - 1)
											+ (_month + 12 < 10 ? "0" : "") + (_month + 12)
											+ "'>" + (year - 1) + (_month + 12 < 10 ? "0" : "")
											+ (_month + 12) + "</option>");
								} else {
									out.println("<option value='" + (year)
											+ (_month < 10 ? "0" : "") + (_month) + "'>"
											+ (year) + (_month < 10 ? "0" : "") + (_month)
											+ "</option>");
								}
							}
							out.println("<option value='" + (year) + (month < 10 ? "0" : "")
									+ (month) + "' selected>" + (year)
									+ (month < 10 ? "0" : "") + (month) + "</option>");
							for (int i = 1; i < 4; i++) {
								int _month = month + i;
								if (_month > 12) {
									out.println("<option value='" + (year + 1) + "0"
											+ (_month - 12) + "'>" + (year + 1) + "0"
											+ (_month - 12) + "</option>");
								} else {
									out.println("<option value='" + (year)
											+ (_month < 10 ? "0" : "") + _month + "'>" + (year)
											+ (_month < 10 ? "0" : "") + _month + "</option>");
								}
							}
						%>
				</select>
				</td>
				<td><div region="south" border="false"
						style="text-align: left; height: 30px; line-height: 30px;">
						<a id="btnEp" class="easyui-linkbutton" icon="icon-ok"
							href="javascript:commit();"> 执行计算</a>
					</div></td>
			</tr>
			<tr id="selectCompany" style="display: ;">
				<th height="100%" class="td_left" valign="middle">公司:<br />
				 <font color="red">蓝色边框即为选中，单击取消选中</font>
				</th>
				<td colspan="2" width="80%"><dsp:companyTag htmlId="company" />
				</td>
			</tr>
		</table>
	</form>
	<script type="text/javascript">
				$(function(){
					//增加鼠标经过事件
					$("#allCompanys td").mouseover(function() {
						$(this).addClass("mouse_hour");
					}).mouseout(function() {
						$(this).removeClass("mouse_hour");
					});
					//监听allCompanys 下所有td的单击事件
					$("#allCompanys td").click(function(){
						var obj = $(this).children();
						if($(obj).attr("checked") == "checked"){
							$(obj).attr("checked",false);
							$(this).removeClass("selecteds");							
						} else {
							$(obj).attr("checked",true);
							$(this).addClass("selecteds");
						}
					});
				});
				function commit(){
					var form = $("#form1").serializeObject();
					$.ajax({
						type : "POST",
						url : config.url + '_c',
						data : form,
						dataType : 'json',
						complete :function( jqXHR, status, responseText ){
							var json = eval("("+ jqXHR.responseText+")");
							if (json.success){
								msgShow("系统提示","成功排入后台,请转到<font color='green'><<消息菜单>></font>中查看最新的消息","info");
							} else {
								msgShow("系统提示",json.msg,"error");
							}
						}
					});
				}
			</script>
</body>
</html>
